package cn.edu.scau.cmi.heyonglin.singleton;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.Stage;

public class controller {
	@FXML
	private  TextField chairmanInput;
	@FXML
	private TextArea output;
	private int spire;
	private Chairman chairman;
	public void control() {
		String name = chairmanInput.getText().trim();
		if(name.length()==0) {
			output.appendText("\n");
			chairmanInput.clear();
		}
		else {
			if(spire==0) {
				spire=1;
				chairman=chairman.getInstance(name);
				output.appendText("主席的名字为："+name+"   "+chairman+"\n");
			}else {
				output.appendText("输入失败，主席已经出存，主席的名字:"+chairman.getName()+"   "+chairman+"\n");
			}
		}
		
	}
	
	
}
